home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- #ifndef PLAYCLASS_H
- #define PLAYCLASS_H
-
- #include <audio.h>
- #include <audiofile.h>
-
- class PlayClass;
-
- typedef void PlayClassCB(void *data, PlayClass *pc);
-
- class PlayClass {
-
- private:
- int init_audio(AFfilehandle, ALport *, ALconfig *);
- int play_audio_samps(AFfilehandle , ALport, ALconfig);
- static void go(void *);
-
- int audio_pid;
- int caught_sigint;
- int paused;
- long filefmt; /* input file format */
- int fd; /* input file descriptor */
- char *myname; /* name of this program */
- int verbose, rude, quiet; /* global flags */
- int bytes_per_samp; /* sample width */
- long bits_per_samp; /* sample resolution */
- int samps_per_frame; /* frame size */
- int frames_per_sec; /* sample rate */
- int bytes_per_buf; /* bytes per sample buffer */
- int samps_per_buf; /* samples per sample buffer */
- int frames_per_buf; /* frames per sample buffer */
- double secs_per_frame; /* time it takes to play one audio frame */
- double secs_per_buf; /* time it takes to play one sample buffer */
- char *sampbuf; /* the sample buffer */
- long compression; /* audio data compression type */
- double file_rate; /* audio file sample rate */
- char *filename;
- PlayClassCB *doneCallback;
- void *userData;
- short sproced;
- short NoDone; /* do I lie about being done? */
-
- // ALconfig audio_port_config;
-
- void attenuatesamps(void *, long, long, double, double,
- double *, double, int);
- short loop;
- short fading_in; /* while fading in */
- short fading_out; /* while fading out */
- double in_time; /* fade in time, sec */
- double play_time; /* play time, sec */
- double out_time; /* fade out time, sec */
- double fade_level; /* current fade_level */
- double max_level; /* maximum output level */
- double emitX, emitY, emitZ; /* the x,y,z position of the emitter */
- double recX, recY, recZ; /* the x,y position of the receiver */
- double distanceFactor; /* this is a class variable for caching rsns */
- short timed; /* are we being timed */
- short useDistance; /* do we care about the distances */
- short distanceChanged; /* do we need to recompute the distance? */
- short isLive; /* is the child process still alive? */
- short isDone; /* are we done playing the audio */
-
- public:
- PlayClass(char *);
- ~PlayClass();
- int beginPlaying(); // begin playing but do not sproc
- void setFilename(char *); // set the audio file name
- void setVerbose(int); // print out what is happening
- void setQuiet(int); // do not print out everything
- void setRude(int); // change the hardware sampling rate
- void setCallback(PlayClassCB *, void *);
- int start(); // play the file
- void fadeOut(); // fade out the audio using the fade out time
- // THIS DOES NOT KILL THE CHILD PROCESS
- void stop(); // stop playing, kills the child process
- void setLoop(short); // set if looping
- void setTime(double); // play the whole thing for an amount of time
- void setInTime(double); // set a fade in and amount of time
- void setOutTime(double); // set a fade out and amount of time
- void setMaxOutputLevel(double); // set the maximum output lvl betwn 0 and 1
- void setNoDone(short);
-
- void setUseDistance(short);
- short getUseDistance();
- void setEmitterPosition(double, double, double);
- void setReceiverPosition(double, double, double);
-
- void pause(); // pause the audio
- void unpause(); // start again
-
- short getIsLive(); // returns true or FALSE if a stop is needed
- short donep(); // returns if done playing the audio
- };
-
- #endif
-